#include "junix.h"

ssize_t jwriten(int fd, char *buf, size_t sz)
{
	char *p=buf;
	size_t left=sz,len;

	while(left>0)
	{
		while( (len=write(fd,p,left))==-1 && errno==EINTR )
		{}

		if(len == -1)
			err_sys("write");

		p += len;
		left -= len;
	}

	return sz;
}

int main(int argc, char **argv)
{
	char *b="hello,world!\n";
	jwriten(STDOUT_FILENO, b, 2);

    exit(0);
}

